<script setup lang="ts">
// This starter template is using Vue 3 <script setup> SFCs
// Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup
import HelloWorld from './components/HelloWorld.vue'
import AL from 'comp/HelloWorld.vue'
import Parent01Vue from './components/Parent01.vue'
import { UtilError } from './types/err'
import Child02 from './components/Child02.vue'
import { ref } from 'vue'
import Child03 from './components/Child03.vue'


fetch('/api/get', { method: 'get' })
.then(res => res.json())
.then(({data}) => console.log(data))

fetch('/abc')
.then(res => res)
.then(res => console.log(res))

console.log(import.meta.env.VITE_BASE_API)

let cmp = {
  c2: ref()
}
let c3 = ref()

function btnClick() {
  console.log(cmp)
  console.log(c3)
}

</script>

<template>
  <img alt="Vue logo" src="./assets/image/icon/logo.png" />
  <HelloWorld msg="Hello Vue 3 + TypeScript + Vite" />
  <img alt="Vue logo" src="/icon/logo.png" />
  <AL msg="Hello Vue 3 + TypeScript + Vite" />

  <Parent01Vue />

  <!-- 获取子组件的方法 -->
  <Child02 :ref="cmp.c2" />
  <Child03 ref="c3" />

  <el-button type="primary" @click="btnClick">点击</el-button>
</template>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
